package com.jjmmbb.db.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jjmmbb.anydolist.R;

@SuppressWarnings("deprecation")
public class MenuAdatper extends BaseAdapter {
	private Context context;
	private int[] buttonArray;

	private final android.widget.Gallery.LayoutParams itemLayoutParams = new Gallery.LayoutParams(
			LinearLayout.LayoutParams.WRAP_CONTENT,
			LinearLayout.LayoutParams.MATCH_PARENT);

	public MenuAdatper(Context c, int[] buttonArray) {
		this.context = c;
		this.buttonArray = buttonArray;
	}

	@Override
	public int getCount() {
		return buttonArray.length;
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		TextView tv = new TextView(this.context);
		tv.setText(context.getString(buttonArray[position]));
		tv.setTextAppearance(context, R.style.Medium);
		tv.setTextColor(Color.BLACK);
		tv.setLayoutParams(itemLayoutParams);
		tv.setPadding(1, 1, 1, 1);
		tv.setBackgroundResource(R.drawable.btn_a);
		return tv;
	}
}
